|
|
|
|
|
|
|
rs.MoveNext
ReadRow
'
End Sub
Private Sub cmdMovePrevious_Click()
'
rs.MovePrevious
ReadRow
'
End Sub |
|
|
|
|
|
|
|
|
You need to add two more routines to finish up the project. The following code forces the first record onto the screen at startup. Add this code to the Form_Activate event: |
|
|
|
|
|
|
|
|
Private Sub Form_Activate()
'
cmdMoveFirst_Click
'
End Sub |
|
|
|
|
|
|
|
|
The last bit of code performs a safe close of the database at the end of the program. Add this code to the Form_Unload event: |
|
|
|
|
|
|
|
|
Private Sub Form_Unload(Cancel As Integer)
'
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
'
End Sub |
|
|
|
|
|
|
|
|
Save the form as FRMMOVE.FRM and save the project as PRJMOVE.VBP. When you run the project, you can click the buttons in order to walk the dataset. This project operates the same as the data control arrow buttons. |
|
|
|
|
| |
|
|
|
|
If you click the First button and then immediately click the Previous button, you get a runtime error. This error is caused by attempting to read past the beginning of the dataset. Later today, you'll create a routine that prevents this error from occurring in your programs. |
|
|
|
|
|
|
|
|
|
|
The project you created in this section is a good example of how you can provide users with a way to browse the dataset on a form. In the next section, you see how to give your users the ability to search for a particular record in the dataset. |
|
|
|
|
|